package com.sf.tools.generate;
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//import java.io.InputStreamReader;
//import java.io.UnsupportedEncodingException;
//import java.util.ArrayList;
//import java.util.List;
//
//import org.dom4j.Document;
//import org.dom4j.DocumentException;
//import org.dom4j.Element;
//import org.dom4j.Node;
//import org.dom4j.io.SAXReader;
//
//import com.sf.tools.common.Common;
//
//
public class Generate {
//
//	public static List<String> _field = new ArrayList<String>();
//	public static List<String> _type = new ArrayList<String>();
//	public static List<String> _desc = new ArrayList<String>();
//	public static List<String> _blank = new ArrayList<String>();
//	public static List<String> _default = new ArrayList<String>();
//	
//	public static List<String> _column = new ArrayList<String>();
//	public static List<String> _length = new ArrayList<String>();
//	
//	public static List<String> query_field = new ArrayList<String>();
//	
//	public static void empty(){
//		_column = new ArrayList<String>();
//		_field = new ArrayList<String>();
//		_type = new ArrayList<String>();
//		_desc = new ArrayList<String>();
//		_blank = new ArrayList<String>();
//		_default = new ArrayList<String>();
//		_length = new ArrayList<String>();
//	}
//	public static void parseXML(String filePath){
//		empty();
//		try {
//			SAXReader reader = new SAXReader();
//			Document document = reader.read(new InputStreamReader(new FileInputStream(Common.filePath),Common.getFileEncoding(Common.filePath)));
////			Document document = reader.read(new InputStreamReader(new FileInputStream(Common.filePath)));
//			Element root = document.getRootElement();
//			@SuppressWarnings("unchecked")
//			List<Element> rowData = root.elements();
//			for (Element row : rowData) {
//				String name = "";
//				String type = "";
//				String desc = "";
//				String blank = "";
//				String defau = "";
//				for (int i = 0; i < row.nodeCount(); i++) {
//					Node node = row.node(i);
//					String columnName = node.getName();
//					if("名称".equals(columnName) || "Name".equalsIgnoreCase(columnName)){
////					System.out.print(node.getText() +"  ");
//						name = node.getText();
//					}
//					if("类型".equals(columnName) || "Type".equalsIgnoreCase(columnName)){
////					System.out.print(node.getText() +"  ");
//						type = node.getText();
//					}
//					if("可为空".equals(columnName) || "Nullable".equalsIgnoreCase(columnName)){
////					System.out.print(node.getText());
//						blank = node.getText().trim();
//					}
//					if("默认".equals(columnName) || "Default".equalsIgnoreCase(columnName)){
////					System.out.print(node.getText());
//						defau = node.getText().trim();
//					}
//					if("注释".equals(columnName) || "Comments".equalsIgnoreCase(columnName)){
////					System.out.print(node.getText());
//						desc = node.getText().trim();
//					}
//				}
////				if(name.toUpperCase().endsWith("ID") && type.equalsIgnoreCase("NUMBER(19)") && blank.equalsIgnoreCase("N")){
////					continue;
////				}
////				System.out.println(name + "---" + type);
//				_column.add(name);
//				_field.add(Common.getFieldName(name));
//				_type.add(Common.getFieldType(type));
//				_desc.add(desc);
//				_blank.add(blank);
//				_default.add(defau);
//				_length.add(Common.getLengthDesc(type));
//				
////				System.out.println(Common.getFieldName(name) + "   " + Common.getFieldType(type) + "   " + desc);
//			}
////			System.out.println(_field.toString());
////			System.out.println(_type.toString());
////			System.out.println(_length.toString());
//		} catch (FileNotFoundException e) {
//			e.printStackTrace();
//		} catch (IndexOutOfBoundsException e) {
//			e.printStackTrace();
//		} catch (DocumentException e) {
//			e.printStackTrace();
//		} catch (UnsupportedEncodingException e) {
//			e.printStackTrace();
//		} 
//	}
//
//	public static String start(){
//		try{
//			BuildEntity.createDoMain(Common.DOMAIN_NAME,Common.filePath);
//			BuildDao.createDao();
//			BuildBiz.createBiz();
//			BuildAction.createAction();
//			BuildConf.createHibernate();
//			BuildConf.createSpring();
//			BuildConf.createStruts();
//			BuildJspAndJs.createJSP();
//			BuildJspAndJs.createJS();
//			return "代码已成功生成!";
//		} catch(Exception e){
//			e.printStackTrace();
//			return "生成失败!";
//		}
//	}
//	
//	public static void main(String[] args) {
////		BuildEntity.createDoMain(Common.DOMAIN_NAME,Common.filePath);
////		BuildDao.createDao();
////		BuildBiz.createBiz();
////		BuildAction.createAction();
////		BuildConf.createHibernate();
////		BuildConf.createSpring();
////		BuildConf.createStruts();
//	}
}
